<?php

class pageComponents extends sfComponents
{
  public function executeHomeAuthors($number)
  {
    $this->authors = array();
    foreach(Tools::$letters as $letter)
    {
      $count = AuthorQuery::create()
        ->filterbyContent(null, Criteria::NOT_EQUAL)
        ->filterByLetter($letter)
        ->count();
      $rand = rand(0, $count-3);
      //echo $letter.' : '.$count.'<br>';
      $this->authors[$letter] = AuthorQuery::create()
        ->setOffset($rand)
        ->limit(3)
        ->filterBycontent(null,Criteria::NOT_EQUAL)
        ->findByLetter($letter);
    }
  }
}
